package com.orhon.smartcampus.modules.systemctl.mm;


import com.alibaba.fastjson.JSON;
import com.orhon.smartcampus.modules.base.mm.DictionaryMapper;
import com.orhon.smartcampus.modules.base.mm.LangMapper;
import com.orhon.smartcampus.modules.systemctl.entity.Menus;
import com.orhon.smartcampus.modules.systemctl.gqlModel.GQLMenus;
import org.mapstruct.*;
import org.mapstruct.factory.Mappers;

import java.util.List;
import java.util.Map;


@Mapper(uses = {
        //DictionaryMapper.class,
        //LangMapper.class,
        //ModuleMapper.class
        MenuMapper.class
})
public interface MenuSqlMapper {

    MenuSqlMapper MAPPER = Mappers.getMapper(MenuSqlMapper.class);


    default GQLMenus toMenus(Map entity){
        String json = JSON.toJSONString(entity);
        Menus Menu = JSON.parseObject(json , Menus.class);
        GQLMenus menus = MenuMapper.MAPPER.toMenus(Menu);
        return menus;
    }

}
